<template>
  <!--  TODO 通用页面：图片、评论-->
  <view v-if="state.type===1" class="p-20">
    <view class="img-box">
      <up-image :show-loading="true" src="https://picsum.photos/seed/picsum/200/300" width="100%"
                height="200rpx" mode="aspectFill"></up-image>
      <up-image :show-loading="true" src="https://picsum.photos/seed/picsum/200/300" width="100%"
                height="200rpx" mode="aspectFill"></up-image>
      <up-image :show-loading="true" src="https://picsum.photos/seed/picsum/200/300" width="100%"
                height="200rpx" mode="aspectFill"></up-image>
      <up-image :show-loading="true" src="https://picsum.photos/seed/picsum/200/300" width="100%"
                height="200rpx" mode="aspectFill"></up-image>
    </view>
  </view>
  <view v-if="state.type===2" class="p-20">
    <view class="flex py-20 m-20" style="border-bottom: 1rpx solid #e0dfdf" v-for="item of 10" :key="item">
      <up-avatar text="犀" random-bg-color size="40"/>
      <view class="ml-10" style="flex:1">
        <view class="flex-between">
          <view>张三</view>
          <view class="f-c-9 f-s-m">2021-12-05</view>
        </view>
        <view class="mt-10 f-s-m">
          这家公司不错，我很喜欢
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import {onLoad} from "@dcloudio/uni-app";
import {reactive} from "vue";

/**
 * @description 1:图片 2:评论
 * @type {Reactive<{type: number}>}
 */

const titleMap = [
  {id: 1, name: '企业图片'},
  {id: 2, name: '企业评论'}
]

const state = reactive({
  type: 1
})

onLoad((e) => {
  state.type = Number(e.type)
  uni.setNavigationBarTitle({
    title: titleMap.find(item => item.id === Number(e.type)).name,
  });
})

</script>

<style lang="scss" scoped>

</style>